﻿/*
	Class Description: a small example of using TracingPanel of MiniDebugger 
	library
	------------------------------------------------------------------------
	                          APACHE LICENSE
	------------------------------------------------------------------------
	Copyright 2010 Vu Thien Nguyen Phong
	
	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at
	
	http://www.apache.org/licenses/LICENSE-2.0
	
	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
	
*/
package  {
	import flash.display.MovieClip;
	import flash.events.Event;
	import com.minidebugger.MiniDebugger;
	import flash.events.MouseEvent;
	
	public class TracingDemo extends MovieClip {
		private var i:int = 289283;
		private var n:Number = Math.random();
		private var s:String = "Hello World!";
		private var bool:Boolean = true;
		private var a:Array = ["plane","car","spaceship"];
		private var a2d:Array = [[0,1,2,3],
								 [4,5,6,7],
								 [8,9]];
		private var obj:Object = {name:"MiniDebuggerDemo",age:1};
		private var mc:MovieClip = new MovieClip();
		
		private var superLongString:String = "this is a very very very very very very very very long string"
		
		public function TracingDemo() {
			addEventListener(Event.ADDED_TO_STAGE,init);
		}
		
		private function init(e:Event):void{
			removeEventListener(Event.ADDED_TO_STAGE,init);
			
			// entry point
			// adding the debug panel to stage
			addChild(MiniDebugger.getTracingPanel());
			
			// trace an integer
			MiniDebugger.trace(i,true,true);
			// trace a decimal number
			MiniDebugger.trace(n,true,true);
			// trace a String
			MiniDebugger.trace(s,true,true);
			// trace a Boolean
			MiniDebugger.trace(bool,true,true);
			// trace an array
			MiniDebugger.trace(a,true,true);
			// trace an object
			MiniDebugger.trace(obj,true);
			// trace a movie clip
			MiniDebugger.trace(mc,true,true);

			// trace a super long string
			MiniDebugger.trace(superLongString);
			// trace multiple variables
			MiniDebugger.trace("This is PI: "+Math.PI.toFixed(4));
			// trace one dimension array
			MiniDebugger.traceArray(a);
			// trace two dimensions array
			MiniDebugger.trace2DArray(a2d);
			// trace object
			MiniDebugger.traceObject(obj);
		}
	}
}
